package finalproject.model.rooms;

import finalproject.config.Randomizer;
import finalproject.model.items.Map;
import finalproject.model.items.Scouter;
import finalproject.model.player.Player;
import finalproject.view.StringManager;

/**
 * Secret is a room in which the player can obtain map or scouter.
 * To reveal the item, the player must do a certain number of interactions in the room.
 * 
 * @author Shafiq Daniel
 */
public class SecretRoom extends Room {
	
	int numInteraction=0;
	boolean mapAvailable = true;
	boolean scouterAvailable = true;
	Map theMap = new Map();
	Scouter theScouter = new Scouter();

	public SecretRoom(String description, boolean isLighted) {
		super(description, isLighted);
		// TODO Auto-generated constructor stub
	}

	@Override
	public boolean prepareActivity(Player p) {
		// TODO Auto-generated method stub
		return false;
	}

	@Override
	public boolean doActivity(Player p) {
		StringManager.outPut("someactivites");
		
		if(numInteraction<3 && mapAvailable){			
			numInteraction++;
		}
			
		else{
			int random = Randomizer.getRandom().nextInt(10);
			
			if(mapAvailable && random > 5){
				p.getItemHolder().addItem(theMap);
				StringManager.outPut("mapavailable");
				mapAvailable=false;
			}
			else if(scouterAvailable && random <= 5){
				p.getItemHolder().addItem(theScouter);
				StringManager.outPut("scouteravailable");
				scouterAvailable=false;
			}
						
		}			
		
		return true;
	}
}
